package com.ruoyi.mapper;

import com.ruoyi.entity.po.TUserChatRoomRelation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 *@author CHN
 *@since 2024-12-15 10:06
 */
public interface TPlayerChatRoomRelationMapper {

    @Select("select * from t_player_chat_room_relation where user_id = #{userId} and room_id = #{roomId}")
    TUserChatRoomRelation selectByUserIdAndRoomId(@Param("userId") Integer userId, @Param("roomId") Integer roomId);

    @Insert("insert into t_player_chat_room_relation(user_id,room_id) values (#{userId},#{record.roomId})")
    int insert(@Param("record") TUserChatRoomRelation record);

    @Delete("delete from t_player_chat_room_relation where user_id = #{userId} and room_id = #{roomId}")
    int deleteByUserIdAndRoomId(@Param("userId") Integer userId, @Param("roomId") Integer roomId);

}
